function ParCoord(canvas) {

	this.shaderfs = "\
\
  void main(void) {\
    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\
  }";

	this.shadervs = "\
  attribute vec2 aVertexPosition;\
\
  uniform mat4 uPMatrix;\
\
  void main(void) {\
    gl_Position = uPMatrix * vec4(aVertexPosition, 0.0, 1.0);\
  }";

	this.gl;
	this.shaderProgram;
	this.pMatrix;
	this.cubeVertexPositionBuffer;
	this.cubeVertexColorBuffer;
	this.cubeVertexIndexBuffer;

	this.webGLStart(canvas);
	this.data = null;
}

ParCoord.prototype.setData = function(data) {
	this.data = data;
}

ParCoord.prototype.initGL = function(canvas) {
	try {
		this.gl = canvas.getContext("experimental-webgl");
	} catch (e) {
	}
	if (!this.gl) {
		alert("Could not initialise WebGL, sorry :-(");
	}
}

ParCoord.prototype.initShaders = function() {
	var gl = this.gl;
	// fragment shader
	var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
	gl.shaderSource(fragmentShader, this.shaderfs);
	gl.compileShader(fragmentShader);
	if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {
		alert(gl.getShaderInfoLog(fragmentShader));
		return null;
	}

	// vertex shader
	var vertexShader = gl.createShader(gl.VERTEX_SHADER);
	gl.shaderSource(vertexShader, this.shadervs);
	gl.compileShader(vertexShader);
	if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
		alert(gl.getShaderInfoLog(vertexShader));
		return null;
	}

	// shader progrram
	var shaderProgram = gl.createProgram();
	gl.attachShader(shaderProgram, vertexShader);
	gl.attachShader(shaderProgram, fragmentShader);
	gl.linkProgram(shaderProgram);

	if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) {
		alert("Could not initialise shaders");
	}

	gl.useProgram(shaderProgram);

	shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram,
			"aVertexPosition");
	gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);

	shaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram,
			"uPMatrix");
	this.shaderProgram = shaderProgram;
}

ParCoord.prototype.makePerspective = function() {
	this.pMatrix = makeOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}

ParCoord.prototype.setMatrixUniforms = function() {
	this.gl.uniformMatrix4fv(this.shaderProgram.pMatrixUniform, false,
			new WebGLFloatArray(this.pMatrix.flatten()));
}

ParCoord.prototype.initBuffers = function() {

	this.cubeVertexPositionBuffer = this.gl.createBuffer();
	this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.cubeVertexPositionBuffer);
	vertices = [ 0.0, 1.0, 0.1, 0.5, 0.2, 0.3, 0.3, 0.2, 0.4, 0.3, 0.5, 0.9,
			0.6, 0.7, 0.7, 0.2, 0.8, 0.4, 0.9, 0.3 ];

	this.gl.bufferData(this.gl.ARRAY_BUFFER, new WebGLFloatArray(vertices),
			this.gl.STATIC_DRAW);
	this.cubeVertexPositionBuffer.itemSize = 2;
	this.cubeVertexPositionBuffer.numItems = 10;

}

ParCoord.prototype.drawScene = function() {
	this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);

	this.makePerspective();

	this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.cubeVertexPositionBuffer);
	this.gl.vertexAttribPointer(this.shaderProgram.vertexPositionAttribute,
			this.cubeVertexPositionBuffer.itemSize, this.gl.FLOAT, false, 0, 0);

	this.setMatrixUniforms();

	this.gl.drawArrays(this.gl.LINE, 0,
			this.cubeVertexPositionBuffer.numItems);

}

ParCoord.prototype.tick = function() {
	this.drawScene();
}

ParCoord.prototype.webGLStart = function(canvas) {
	var canvas = document.getElementById(canvas);

	this.initGL(canvas);
	this.initShaders();
	this.initBuffers();

	this.gl.clearColor(0.0, 0.0, 0.0, 1.0);

	this.gl.clearDepth(1.0);

	this.gl.enable(this.gl.DEPTH_TEST);
	this.gl.depthFunc(this.gl.LEQUAL);

	// setInterval(tick, 15);
	this.tick();
}
